;(function(){
	'use strict';
	angular.module('controllers.analysisSysOM.cleanCount')
	.controller('handlingTimeController',handlingTimeController);
	function handlingTimeController($scope,CoreService,COREDATA,cleanCountService,CtrlShowAndHide,handlingTimeFactory){
		//页面查询项绑定对象
		$scope.sendData = handlingTimeFactory.pageBind();
		/**
		 * @$scope.flag   控制页面显示隐藏  
		 * 里面包含 $scope.flag.show  页面表格和图表的显示隐藏
		 *          $scope.flag.state  页面查询按钮的拉上拉下
		 *          $scope.flag.arrow  页面箭头显示隐藏
		 *          $scope.flag.items  页面表格数据
		 *          $scope.flag.title  页面表格标题
		 *          $scope.flag.outData  导出参数
		 * @type {object}
		 */
		$scope.flag = CtrlShowAndHide.flag;
		//导出路径
		$scope.formPrefix = COREDATA.FORMPREFIX + 'analysisSysOM/cleanCount/queryHandlingTimeExport';
		//监听表单,当表单有错时,禁止查询
		$scope.$watch('myForm.$invalid', function(newValue) {
			newValue ? $scope.btnDisabled = true : $scope.btnDisabled = false;
			$scope.flag.arrow = false;
		});
		//切换列表
		$scope.changeView = function(){
			$scope.flag.show = 'view';
		};
		//切换图表
		$scope.changeTable = function(){
			$scope.flag.show = 'table';
		};
		//退出当前页面时,初始化CtrlShowAndHide.flag对象
		$scope.$on('$destroy',function(){
      CtrlShowAndHide.destroyFn();
    });
		//查询方法
		$scope.search = handlingTimeFactory.search;
		
		//默认查询
		$scope.search($scope.sendData);
	}
	handlingTimeController.$inject = ['$scope','CoreService','COREDATA','cleanCountService','CtrlShowAndHide','handlingTimeFactory'];
})();